﻿using System;
using System.Windows.Data;

namespace QDP.Platform.Silverlight.Converters
{
    /// <summary>布尔值转透明度</summary>
    public class BoolToOpacityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null && value is bool )
            {
                return System.Convert.ToBoolean(value) ? 1 : System.Convert.ToDouble(parameter);
            }
            return 1;
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
